<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>第八十一节课</title>
    <link rel="stylesheet" href="../css/common.css">
    <script type="text/javascript" src="../js/jquery.js"></script>
    <script>
        $(function () {
            var object1 = {
                apple:0,
                banana:{weight:52,price:100},
                cherry:97
            };
            var object2 = {
                banana:{price:200},
                durian:100
            };
            var object3 = jQuery.extend({},object1,object2);
            // jQuery.extend(true,object1, object2);//加true的话object2的属性不会覆盖object1相应的属性
            jQuery.extend(object1, object2);//加true不会覆盖
            console.log(object1);
            console.log(object2);
            console.log(object3);
            console.log(object1.banana.weight);
            console.log(object1.banana.price);
            console.log(object2.banana.price);
        })
    </script>
</head>
<body>

</body>
</html>
